Function: c-forward-<>-arglist

c-forward-<>-arglist is a byte-compiled function defined in cc-engine.el.gz.

Signature

(c-forward-<>-arglist ALL-TYPES)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-forward-<>-arglist (all-types)
  ;; The point is assumed to be at a "<".  Try to treat it as the open
  ;; paren of an angle bracket arglist and move forward to the
  ;; corresponding ">".  If successful, the point is left after the
  ;; ">" and t is returned, otherwise the point isn't moved and nil is
  ;; returned.  If ALL-TYPES is t then all encountered arguments in
  ;; the arglist that might be types are treated as found types.
  ;;
  ;; The variable `c-parse-and-markup-<>-arglists' controls how this
  ;; function handles text properties on the angle brackets and argument
  ;; separating commas.
  ;;
  ;; `c-restricted-<>-arglists' controls how lenient the template
  ;; arglist recognition should be.
  ;;
  ;; This function records identifier ranges on
  ;; `c-record-type-identifiers' and `c-record-ref-identifiers' if
  ;; `c-record-type-identifiers' is non-nil.
  ;;
  ;; This function might do hidden buffer changes.

  (let ((start (point))
	(old-record-type-identifiers c-record-type-identifiers)
	(old-found-types (copy-hash-table c-found-types))
	;; If `c-record-type-identifiers' is set then activate
	;; recording of any found types that constitute an argument in
	;; the arglist.
	(c-record-found-types (if c-record-type-identifiers t)))
    ;; Special handling for C++20's "import <...>" operator.
    (if (and (c-major-mode-is 'c++-mode)
	     (save-excursion
	       (and (zerop (c-backward-token-2))
		    (looking-at "import\\>\\(?:[^_$]\\|$\\)"))))
	(when (looking-at "<\\(?:\\\\.\\|[^\\\n\r\t>]\\)*\\(>\\)?")
	  (if (match-beginning 1)	; A terminated <..>
	      (progn
		(when c-parse-and-markup-<>-arglists
		  (c-mark-<-as-paren (point))
		  (c-mark->-as-paren (match-beginning 1))
		  (c-truncate-lit-pos-cache (point)))
		(goto-char (match-end 1))
		t)
	    nil))
      (if (catch 'angle-bracket-arglist-escape
	    (setq c-record-found-types
		  (c-forward-<>-arglist-recur all-types)))
	  (progn
	    (when (consp c-record-found-types)
	      (let ((cur c-record-found-types))
		(while (consp (car-safe cur))
		  (c-fontify-new-found-type
		   (buffer-substring-no-properties (caar cur) (cdar cur)))
		  (setq cur (cdr cur))))
	      (setq c-record-type-identifiers
		    ;; `nconc' doesn't mind that the tail of
		    ;; `c-record-found-types' is t.
		    (nconc c-record-found-types c-record-type-identifiers)))
	    t)

	(setq c-record-type-identifiers old-record-type-identifiers
	      c-found-types old-found-types)
	(goto-char start)
	nil))))